import {
  createRouter,
  createWebHistory,
  createWebHashHistory,
} from 'vue-router'

// 开发测试路由
const devTestRouters = [
  {
    path: '/world',
    name: 'world',
    component: () => import('../views/World3D/World.vue'),
  },
  {
    path: '/china',
    name: 'china',
    component: () => import('../views/Maps/ChinaMap.vue'),
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/testPage/test.vue'),
  },
  {
    path: '/test1',
    name: 'test1',
    component: () => import('../views/testPage/test1.vue'),
  },
  {
    path: '/test-ase',
    name: 'test-ase',
    component: () => import('../views/testPage/ase.vue'),
  },
  {
    path: '/test-box',
    name: 'test-box',
    component: () => import('../views/testPage/testBox.vue'),
  },
  {
    path: '/test-header',
    name: 'test-header',
    component: () => import('../views/testPage/testHeader.vue'),
  },
  {
    path: '/test-dialog',
    name: 'test-dialog',
    component: () => import('../views/testPage/testDialog.vue'),
  },
  {
    path: '/test-side',
    name: 'test-side',
    component: () => import('../views/testPage/testSide.vue'),
  },
  {
    path: '/test-group',
    name: 'test-group',
    component: () => import('../views/testPage/testGroup.vue'),
  },
]

const router = createRouter({
  history: createWebHistory('/'),
  routes: [
    {
      path: '/',
      name: 'index',
      component: () => {},
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/Home/HomePage.vue'),
      meta: {
        title: '全球业绩',
        isLoad: true,
      },
    },
    {
      path: '/finance',
      name: 'finance',
      component: () => import('../views/Finance/FinancePage.vue'),
      meta: {
        title: '全球财务',
        isLoad: true,
      },
    },
    {
      path: '/supply',
      name: 'supply',
      component: () => import('../views/Supply/SupplyPage.vue'),
      meta: {
        title: '全球供应链',
        isLoad: true,
      },
    },
    {
      path: '/human',
      name: 'human',
      component: () => import('../views/Human/HumanPage.vue'),
      meta: {
        title: '全球人力',
        isLoad: true,
      },
    },
    {
      path: '/dealer-data',
      name: 'dealer-data',
      component: () => import('../views/Dealer/DealerPage.vue'),
      meta: {
        title: '经销商看板',
        isLoad: true,
      },
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login/Login.vue'),
      meta: {
        title: '登录',
        isLoad: false,
      },
      children: [],
    },
    // 当是开发环境时，添加测试路由
    ...(process.env.NODE_ENV === 'development' ? devTestRouters : []),
  ],
})

export default router
